package org.example;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@MapperScan(basePackages = {"org.example.mapper"})
public class MybatisPlusConfig {


    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }

    public static void main(String[] args) {
        //        for (int i = 0; i < 30; i++) {
        //            System.out.println(String.format(
        //                    "spring.shardingsphere.sharding.tables.repay_plan_%d.actual-data-nodes=ds-1.repay_plan_%d",
        //                    i, i));
        //        }
        for (int i = 0; i < 1024; i++) {
            if (i % 100 == 0) {
                System.out.println("");
                System.out.print("mget ");
            }
            System.out.print(String.format(" WORKER_ID:%d", i));
        }
        final long twepoch = 1288834974657L;
        String s1 = "101111101111010101101001000111101010101";
        String s2 = "101111101111010101101001000111101111101";
        Long l1 = Long.parseLong(s1, 2) + twepoch;
        Long l2 = Long.parseLong(s2, 2) + twepoch;
        System.out.println();
        System.out.println(s1.equals(s2));
        System.out.println(l1.equals(l2));
        String date1 = DateFormatUtils.format(l1, "yyyy-MM-dd HH:mm:ss.SSS");
        String date2 = DateFormatUtils.format(l2, "yyyy-MM-dd HH:mm:ss.SSS");
        System.out.println(date1 + " " + date2);

    }
}
